/**
 * Created by qlm on 2016/3/2.
 */
angular.module("routerApp",['ui.router'])
	.config(function($urlRouterProvider, $stateProvider, $locationProvider){
		$locationProvider.hashPrefix("!");
		$urlRouterProvider.when("/", "index")
			.when("/components","/components/button")
			.otherwise("index");

		$stateProvider.state("index",{
				url : "/index",
				views:{
					"main":{
						templateUrl : "views/index.html"
					}
				}

			})
			.state("normal", {
				url : "/normal",
				views:{
					"main":{
						templateUrl : "views/commonUI.html"
					}
				}
			})
			.state("components",{
				url : "/components",
				views : {
					"main" : {
						templateUrl : "views/components.html"
					}
				}
			})
			.state("components.button", {
				url : "/button",
				views : {
					"componentBody" : {
						templateUrl : "views/components/button.html"
					}
				}
			})
			.state("components.list", {
				url : "/list",
				views : {
					"componentBody" : {
						templateUrl : "views/components/list.html"
					}
				}
			})
            .state("components.searchbar", {
                url : "/searchbar",
                views : {
                    "componentBody" : {
                        templateUrl : "views/components/searchbar.html",
                        controller : "searchCtrl"
                    }
                }
            })
            .state("components.form", {
                url : "/form",
                views : {
                    "componentBody" : {
                        templateUrl : "views/components/form.html"
                    }
                }
            })
            .state("components.loading", {
                url : "/loading",
                views : {
                    "componentBody" : {
                        templateUrl : "views/components/loading.html"
                    }
                }
            })
            .state("components.avatar", {
                url: "/avatar",
                views: {
                    "componentBody": {
                        templateUrl: "views/components/avatar.html"
                    }
                }
            })
            .state("components.dot", {
                url: "/dot",
                views: {
                    "componentBody": {
                        templateUrl: "views/components/dot.html"
                    }
                }
            })
            .state("components.badge", {
                url: "/badge",
                views: {
                    "componentBody": {
                        templateUrl: "views/components/badge.html"
                    }
                }
            })
            .state("components.tag", {
                url: "/tag",
                views: {
                    "componentBody": {
                        templateUrl: "views/components/tag.html"
                    }
                }
            })
			.state("components.tab",{
				url : "/tab",
				views : {
					"componentBody" : {
						templateUrl: "views/components/tab.html"
					}
				}
			})
            .state("components.slider", {
                url: "/slider",
                views: {
                    "componentBody": {
                        templateUrl: "views/components/slider.html"
                    }
                }
            })
            .state("components.tips",{
                url : "/tips",
                views : {
                    "componentBody" : {
                        templateUrl: "views/components/tips.html"
                    }
                }
            })
            .state("components.newstips", {
                url : "/newstips",
                views : {
                    "componentBody" : {
                        templateUrl: "views/components/newstips.html"
                    }
                }

            })
            .state("components.poptips",{
                url : "/poptips",
                views : {
                    "componentBody" : {
                        templateUrl: "views/components/poptips.html",
                        controller: "dialog"
                    }
                }
            })
            .state("components.topbar",{
                url : "/topbar",
                views : {
                    "componentBody" : {
                        templateUrl: "views/components/topbar.html"
                    }
                }
            })
            .state("components.dialog",{
                url : "/dialog",
                views : {
                    "componentBody" : {
                        templateUrl: "views/components/dialog.html",
                        controller: "dialog"
                    }
                },
	            enter : function(){
		            console.log("in");
	            }
            })
            .state("components.actionsheet",{
                url : "/actionsheet",
                views : {
                    "componentBody" : {
                        templateUrl: "views/components/actionsheet.html"
                    }
                }
            })
			.state("components.animation",{
				url : "/animation",
				views : {
					"componentBody" : {
						templateUrl: "views/components/animation.html"
					}
				}
			});
	});
